home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / praf205e / mbbios.doc < prev    next >
Text File  |  1995-04-01  |  16KB  |  409 lines

  1. MBBIOS is an assembler language program that captures INT 14 (the COM
  2. service call) and extends it with support for the 8250 async port in
  3. buffered mode and adds support for the 8530 PACCOMM PC-100 packet board.
  4. It is configured by the file MBCNF.ASM.  MBBIOS is a resident extension
  5. to DOS and only has to be invoked once.
  6.  
  7. PC-100 support is NOT normally included in the files.
  8.  
  9.     Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 by H. Roy Engehausen.
  10.     All rights reserved.  This software may be freely distributed and used,
  11.     but it may not under any circumstances be sold by anyone other than the
  12.     author.  It may be distributed by a commercial company as long as it is
  13.     for no cost.
  14.  
  15. ================================================================================
  16. !                                                                              !
  17. !  Changes                                                                     !
  18. !                                                                              !
  19. ================================================================================
  20.  
  21. V 3.5 -- 16550A support, Desqview support, improved break.
  22.          Thanks to N2GTE for the latter two items.  See notes
  23.          further down for enabling Desqview support
  24.  
  25. V 3.6 -- High speed handshaking.  Remove PC-100 support as default.
  26.  
  27. V 3.7 -- Fix bugs in handshake.  Remove use of DTR in handshake as default.
  28.  
  29. V 3.8 -- Variable handshaking.  Add control function.
  30.  
  31. ================================================================================
  32. !                                                                              !
  33. !  File contents                                                               !
  34. !                                                                              !
  35. ================================================================================
  36.  
  37. Files included are:
  38.  
  39. MBBIOS  .COM   -- The resident program.  Comes configured for COM1 as
  40.                   standard ASYNC
  41.  
  42. MBBIOSDT.COM   -- The resident program but for units that use DTR for
  43.                   handshaking.  See note below under hardware handshaking.
  44.  
  45. MBBCONFG.COM   -- Configuration control program
  46. MS400   .MOD   -- How you share interrupts on a DFI MS-400 card
  47.  
  48. This ZIP file may contain the source code.  If not, you can get it by
  49. sending $5 US (or equivalent) to:
  50.  
  51.  Dave Larton, N6JQJ
  52.  353-C East 10th Street, Box 124
  53.  Gilroy, CA  95020-4149
  54.  (408) 778-7265
  55.  
  56. 8250con .asm   -- 8250 hardware constants
  57. 8250ini .asm   -- 8250 initialization
  58. 8250int .asm   -- 8250 interrupt handler
  59. 8250svc .asm   -- 8250 service call handler
  60. 8250svcx.asm   -- 8250 service call handler (extended)
  61. 8250tmr .asm   -- 8250 timer pop handler
  62.  
  63. qrqpcon .asm   -- Quadram QuadPort hardware constants
  64. qrqpini .asm   -- Quadram QuadPort initialization
  65.  
  66. 8530con .asm   -- 8530 hardware constants
  67. 8530ini .asm   -- 8530 initialization
  68. 8530int .asm   -- 8530 interrupt handler
  69. 8530svc .asm   -- 8530 service routines
  70. 8530tmr .asm   -- 8530 timer pop handler
  71. kiss    .asm   -- KISS constants
  72.  
  73. asmmb   .bat   -- BAT routine to assemble MBBIOS
  74.  
  75. mbbios  .asm   -- Main line
  76. mbbcom  .asm   -- Control block format
  77. mbbinit .asm   -- Initialization routine
  78. mbbinter.asm   -- Interrupt handler
  79. mbbload .asm   -- Load MBBIOS
  80. mbbsubr .asm   -- General Subroutines
  81. mbbtimer.asm   -- Timer pop handler
  82. mbbusvc .asm   -- User request service routine
  83. desqview.asm   -- Interface to desqview
  84.  
  85. mbcnf   .asm   -- ASM file configured for COM1 and two PC-100 ports
  86.  
  87. ================================================================================
  88. !                                                                              !
  89. !  Configuring                                                                 !
  90. !                                                                              !
  91. ================================================================================
  92.  
  93. Use MBBCONFG to configure the tables inside MBBIOS with regards to your
  94. particular hardware configuration.  All ports which share interrupts must be
  95. defined!  Thus if you a port on a PC-1XX, define both ports.  If you use a
  96. port on a MS-400 with the diode modification, you must define all the ports
  97. with diodes on them.
  98.  
  99. ================================================================================
  100. !                                                                              !
  101. !  Parameter explanations                                                      !
  102. !                                                                              !
  103. ================================================================================
  104.  
  105. The HIGH SPEED option is used to shift the data rate table.  See the
  106. explanation on AH=0 below.
  107.  
  108. TRANSMIT BUFFERING allows MBBIOS to return control to the calling
  109. program before the character is fully sent.
  110.  
  111. HARDWARE HANDSHAKING makes MBBIOS follow the RTS/CTS handshaking system
  112. used by many TNCs.  ***NOTE*** TNC-1s are no longer supported for
  113. handshaking.  If this is a problem, use the MBBIOSDT.COM file instead.
  114. This does not affect TNC-1 with AA4RE BBS since that uses host mode.
  115.  
  116. Recommended settings:
  117.  
  118.     Type BBS -->          RLI/MBL/BQE       Host mode (e.g. AA4RE BB)
  119.  
  120.     Transmit Buffering    Try ON.  If       Must be ON
  121.                           you get hangs,
  122.                           OFF
  123.  
  124.     Hardware Handshake    Must be ON        Must be OFF
  125.  
  126. ================================================================================
  127. !                                                                              !
  128. !  Using                                                                       !
  129. !                                                                              !
  130. ================================================================================
  131.  
  132. Simply execute MBBIOS before running the program that needs it.  If you
  133. wish to unload MBBIOS for some reason, issue MBBIOS /U.
  134.  
  135. Desqview users should specify /d when loading.  Example:  MBBIOS /D
  136.  
  137. ================================================================================
  138. !                                                                              !
  139. !  Software Notes                                                              !
  140. !                                                                              !
  141. ================================================================================
  142.  
  143. --------------------------------------------------------------------------------
  144. !                                                                              !
  145. !  ASYNC + Extended Support for BBS                                            !
  146. !                                                                              !
  147. --------------------------------------------------------------------------------
  148.  
  149. MBBIOS supports the standard INT 14 calls plus the extended ones as
  150. defined by Jeff Jacobsen, WA7MBL for his BBS program.  These are
  151. explained below.  AH=0 to AH=3 are identical to the IBM BIOS definition.
  152.  
  153. AH = 0     Initialize
  154. ---------------------
  155.  
  156. This initializes the communications port.  AL contains parity, stop bit,
  157. and word length as in the standard BIOS call.  On return, AH contains
  158. the Line Status Register information (except bit 0 - Data ready tells
  159. whether there is information in the extended buffer rather than the SIO
  160. chip receive buffer).  AL contains the Modem Status Register.
  161.  
  162. The baud rate is selected via AL.  If the high speed option is off, the
  163. rate is a specified for the standard BIOS call.  If the high speed
  164. option is on the speed settings are from the alternate table
  165.  
  166. High speed option off:
  167.  
  168.     MSB                                                     LSB
  169.      7       6       5       4       3       2       1       0
  170.      ----data-rate----       -Parity--    Stopbits   --Word length--
  171.  
  172.      000 -   110             X0 - none      0 - 1    10 - 7 bits
  173.      001 -   150             01 - odd       1 - 2    11 - 8 bits
  174.      010 -   300             11 - even
  175.      011 -   600
  176.      100 -  1200
  177.      101 -  2400
  178.      110 -  4800
  179.      111 -  9600
  180.  
  181. High speed option on:
  182.  
  183.     MSB                                                     LSB
  184.      7       6       5       4       3       2       1       0
  185.      ----data-rate----       -Parity--    Stopbits   --Word length--
  186.  
  187.      000 -    9600           X0 - none      0 - 1    10 - 7 bits
  188.      001 -   14400           01 - odd       1 - 2    11 - 8 bits
  189.      010 -   19200           11 - even
  190.      011 -   28800
  191.      100 -   38400
  192.      101 -   57600
  193.      110 -  115200
  194.      111 -  330400
  195.  
  196. The high speed option can be set either by MBBCONFG or by software
  197. using AH=9 (see below).
  198.  
  199.  
  200.  
  201. AH = 1     Send Character
  202. -------------------------
  203. AL contains the character to send.  Return values are the same as above.
  204.  
  205. AH = 2     Receive Character
  206. ----------------------------
  207.  
  208. On return, AL contains the character received.  AH contains the
  209. composite receive LSR.  This is done by ORing all LSRs on receive
  210. interrupts together.  Therefore the LSR returned does not necessarily
  211. match the LSR for the the character this routine returns).  Again, AH
  212. bit 0 indicates if there is additional characters in the buffer.  This
  213. routine does NOT timeout while waiting for a character but will hang
  214. indefinitely waiting for a character to appear.
  215.  
  216. AH = 3     Return Status
  217. ------------------------
  218.  
  219. Return values are the same as returned by the Initialize routine.
  220.  
  221. AH = 4     Inquiry
  222. ------------------
  223.  
  224. AH returns 0AAH.  AL returns 055H.  This call is used to see if the
  225. MBBIOS driver has been loaded for a particular port.
  226.  
  227. AH = 5     Drop Handshaking
  228. ---------------------------
  229.  
  230. This drops the handshaking signals.  Used to tell the TNC not to
  231. send any more information.  No return value.
  232.  
  233. AH = 6     Raise Handshaking
  234. ----------------------------
  235.  
  236. Turns the handshaking bits back on.
  237.  
  238. AH = 7     Send Break
  239. ---------------------
  240.  
  241. Generates a "Break".  Useful for getting TNC-2 or PK-232 into Command
  242. mode from Converse or Transparent mode.  (However, if the TNC is sending
  243. characters at the time, they will be garbled.)  No return value.
  244.  
  245. AH = 8     Non-destructive Read
  246. -------------------------------
  247.  
  248. Returns the next character in the buffer in AL without removing it from
  249. the buffer.  AH value defined as in AH=2 so you can use the Data Ready
  250. bit to check to see if you really did get a character.
  251.  
  252. AH = 9     Set/Get options
  253. --------------------------
  254.  
  255. Set the current option byte to AL returning the old option byte in AL.
  256. The option byte is defined as follows:
  257.        .......xB    Transmit buffering (1 = on, 0 = off)
  258.        .....x..B    Hardware handshaking (1 = on, 0 = off)
  259.        ..x.....B    High speed option (1 = on, 0 = off)
  260.        xx.xx.x.B    Reserved.  May be in use on other types of devices
  261.  
  262. AH = A     Write buffer
  263. -----------------------
  264.  
  265. Sends CX characters starting at DI:ES.  Upon return, DI will be updated
  266. and CX will contain the unsent character count.  Unsent characters could
  267. result from either BUFFER FULL or hardware handshake is OFF.  AX will
  268. be set as in AH=3 (Status) above.
  269.  
  270. AH = B Read buffer
  271. ------------------
  272.  
  273. Receives up to CX characters starting at DI:ES.  Upon return, CX set to
  274. actual count read and DI is updated.  If the buffer is empty, return is
  275. immediate with CX = 0. On return, AL contains the MSR and AH has the
  276. composite receive LSR.  This is done by ORing all LSRs on receive
  277. interrupts together.  Therefore the LSR returned does not necessarily
  278. match the LSR for the the character this routine returns).  Again, AH
  279. bit 0 indicates if there is additional characters in the buffer.  This
  280. could happen if characters were received between the time of the buffer
  281. movement and the loading of the LSR into AH.
  282.  
  283.  
  284. AH = D Control
  285. --------------
  286.  
  287.    Subcommand AL = 0
  288.    -----------------
  289.  
  290.        Gives the available bytes in the buffers.  Returns AX = bytes
  291.        available in TX buffer and CX = bytes available in RX buffer.
  292.  
  293.    Subcommand AL = 1
  294.    -----------------
  295.        Turns off all modem controls (DTR RTS, etc).
  296.  
  297.    Subcommand AL = 2
  298.    -----------------
  299.        Turns on all modem controls (DTR RTS, etc).
  300.  
  301.    Subcommand AL = 3
  302.    -----------------
  303.        CL is used to set the handshake byte.
  304.        On exit, CL contains the previous handshake byte.
  305.  
  306. --------------------------------------------------------------------------------
  307. !                                                                              !
  308. !  PACCOM PC-100, PC-110, PC-120 support                                       !
  309. !           This may not be included in this version...                        !
  310. --------------------------------------------------------------------------------
  311.  
  312. AH = 0     Initialize
  313. ---------------------
  314.  
  315. Parms
  316.   xxx..... = Data rate.  Use same settings as IBM ROM BIOS.
  317.              300 bps = 2, 1200 bps= 4.
  318.  
  319.   ...x.... = Full duplex if 1.  Half duplex if 0.
  320.  
  321.   ....x... = Error packet handler.  0 = throw away all error
  322.              packets.
  323.  
  324.   .....xxx = Don't care.  Use 0 for now!
  325.  
  326. Special case -- If AL = 0 then the COM port is closed!
  327.  
  328. The bits shown are used for parity on an ASYNC port and will be zero for
  329. a KISS interface so it should be compatible with TCP/IP usage of INT 14.
  330.  
  331. AH = 1,2   Send/Receive Characters
  332. ----------------------------------
  333.  
  334. See above.  Packets are handled in KISS format.  Note that all commands
  335. which set time are rounded to the nearest 50ms value.
  336.  
  337. AH = 3     Status
  338. -----------------
  339.  
  340. Returns AH.. AL=0
  341.      0.00000. = not assigned.  Zero
  342.      .x...... = If 0 then packets remain in the transmit queue
  343.      .......x = If 1 then data await in the receive queue
  344.  
  345. These bits correspond to THRE and RDA so are compatible to ASYNC ports
  346.  
  347. AH = 4     Inquiry
  348. ------------------
  349.  
  350. AH returns 0AAH.  AL returns 055H.  This call is used to see if the
  351. MBBIOS driver has been loaded for a particular port.
  352.  
  353. AH = 10    Send a packet
  354. ------------------------
  355.  
  356. ES = Segment of buffer containing the packet to be sent.  Note: The
  357. buffer pointed to by ES will be freed when the packet is sent unless
  358. this is turned off.  It should be gotten via Opcode 12. It must be 512
  359. bytes long and conform to the layout of the buffers
  360.  
  361.             Buffer Layout:
  362.  
  363.                 0 - 503 -- data (504 bytes long)
  364.               504 - 505 -- 16 bit data length
  365.               506       -- flags/status #1
  366.                               x........ = If 1 then don't discard
  367.                                           this buffer after xmt.
  368.                               .x....... = If 1 then this buffer has
  369.                                           been transmitted
  370.                               ..0000000 = not used
  371.               507       -- flags/status #2
  372.                               000000000 = not used
  373.               508 - 509 -- User field.  Not used by MBBIOS
  374.               510 - 511 -- MBBIOS uses as a pointer to next buffer in chain
  375.  
  376. AH = 11    Receive a packet
  377. ---------------------------
  378.  
  379. Returns ES with segment of buffer containing the packet received.  If
  380. zero, no such packet exists.
  381.  
  382. AH = 12    Buffer management
  383. ----------------------------
  384.  
  385. If ES is zero then returns a buffer segment in ES.  If ES is non-zero
  386. then the buffer pointed to is freed.
  387.  
  388. AH = 13    Set TXD -- Time from RTS to start or packet
  389. ------------------------------------------------------
  390.  
  391. AL = new setting in clock counts (54.3 ms)
  392.  
  393. AH = 14    Set P (persistance) -- Controls time from end of DCD to RTS
  394. ----------------------------------------------------------------------
  395.  
  396. AL = new setting.  255 = 1.0
  397.  
  398. AH = 15    Set Slot time -- Controls time from end of DCD to RTS
  399. ----------------------------------------------------------------
  400.  
  401. AL = new setting in clock counts (54.3 ms)
  402.  
  403. AH = 16    Set CRC wait -- time from start of last character to drop RTS
  404. ------------------------------------------------------------------------
  405.  
  406. AL = new setting in clock counts (54.3 ms)
  407.  
  408. Should be 5 character lengths minimum
  409.